﻿/*ajax*/
(function ($) {
    var ajax = {};
    /**
    * get 请求示例
    */
    ajax.get = function () {
        return $.ajax({
            url: "/example",
            type: "GET",
            async: true,
            data: {

            },
        });
    };
    /**
     * post 请求示例
     */
    ajax.post = function (id) {
        return $.ajax({
            url: "/api/services/Folder/CreateFolder",
            type: "post",
            data: {
            }
        });
    };
    /**
     * post json 请求示例
     */
    ajax.postJson = function (id) {
        return $.ajax({
            url: "/api/services/Folder/CreateFolder",
            type: "post",
            data: JSON.stringify({
                Name: folderName,
                ParentFolderId: parentFolderId,
            }),
            contentType: "application/json",
            processData: false,
        });
    };
    ajax.getActionCombos = function () {
        return $.ajax({
            url: "/api/ActionStatistic/GetActionCombos",
            type: "GET",
            async: true,
            data: {

            },
        });
    };

    ajax.getTargetStatisticInfo = function (targetId, targetType, userId) {
        return $.ajax({
            url: "/api/ActionStatistic/GetTargetStatisticInfo",
            type: "GET",
            async: true,
            data: {
                targetId,
                targetType,
                userId
            },
        });
    };

    ajax.getTargetOwnerStatisticInfo = function (targetOwnerId) {
        return $.ajax({
            url: "/api/ActionStatistic/GetTargetOwnerStatisticInfo",
            type: "GET",
            async: true,
            data: {
                targetOwnerId
            },
        });
    };

    ajax.getUserStatisticInfo = function (userId) {
        return $.ajax({
            url: "/api/ActionStatistic/GetUserStatisticInfo",
            type: "GET",
            async: true,
            data: {
                userId
            },
        });
    };

    ajax.addOperationRecord = function (actionComboId, actionId, targetId, targetType, userId, targetOwnerId) {
        return $.ajax({
            url: "/api/ActionStatistic/AddOperationRecord",
            type: "GET",
            async: true,
            data: {
                actionComboId, actionId, targetId, targetType, userId, targetOwnerId
            },
        });
    };
    window.ajax = ajax;
}
)(jQuery)